#include "MemoryAllocation.h"
#include "Libs/External/google-perftools-1.7/google-perftools-1.7/src/windows/google/tcmalloc.h"  

namespace AlgoTrading
{
	namespace ConnectionLibrary
	{

		handler_allocator::handler_allocator()
		{
		}

		void* handler_allocator::allocate(std::size_t size)
		{
			  return tc_malloc(size);
		}

		void handler_allocator::deallocate(void* pointer)
		{
			tc_free(pointer);
		}


		//template <typename Handler>
		//custom_alloc_handler<Handler>::custom_alloc_handler(handler_allocator& a, Handler h)
		//	: allocator(a),
		//	handler(h)
		//{
		//}

		/*template <typename Handler>
		template <typename Arg1>
		void custom_alloc_handler<Handler>::operator()(Arg1 arg1)
		{
			handler(arg1);
		}

		template <typename Handler>
		template <typename Arg1, typename Arg2>
		void custom_alloc_handler<Handler>::operator()(Arg1 arg1, Arg2 arg2)
		{
			handler(arg1, arg2);
		}*/

		/*template <typename Handler>
		void* asio_handler_allocate(std::size_t size, custom_alloc_handler<Handler>* this_handler)
		{
			return this_handler->allocator.allocate(size);
		}*/

		//template <typename Handler>
		//void asio_handler_deallocate(void* pointer, std::size_t /*size*/, custom_alloc_handler<Handler>* this_handler)
		//{
		//	this_handler->allocator.deallocate(pointer);
		//}
	}
}

